#ifndef WHALESTREAMTAB_H
#define WHALESTREAMTAB_H

#include "whaletabbase.h"

#include <QWidget>
#include <QVariant>
#include <QVBoxLayout>

class WhaleAbstractConnect;
class WhaleAbstractEntry;

// a base class for tabs that support streaming
// or just display data from a request in a row

// all classes directly inheriting this class
// must provide a newEntry slot
class WhaleStreamTab : public WhaleTabBase {
    Q_OBJECT

    public:
        WhaleStreamTab( QWidget * parent = 0 );
        QWidget * title(); // return the top widget
        QVBoxLayout * streamLayout(); // return the layout object of the tab

    public slots:
        void setTitle( QWidget * title ); // set the widget to be on top of the tab
        void setTitleText( QString text ); // set the text if the standard title is used
        void addConnector( WhaleAbstractConnect * c ); // associate connector with the tab
        void addData( QVariantList data, QString streamName ); // get data connector received

        // define newEntry function in your child class to define a way to render data
        virtual WhaleAbstractEntry * newEntry( QVariantMap data, QString streamName ) = 0;

        void clearStream(); // clear data in the stream

    signals:
        void newStreamData(); // inform other classes that we have new data

    private:
        QWidget * mTitle;
        QWidget * mTabTop;
        QVBoxLayout * mStreamLayout;
};

#endif
